package com.baoer.controler;

import com.baoer.R;
import com.baoer.dto.req.OrderInfoReqDTO;
import com.baoer.dto.req.SalesDetailReqDTO;
import com.baoer.dto.req.SalesStatisticsReqDTO;
import com.baoer.service.OrderService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: YING
 * @CreateTime: 2025-06-26
 * @Description: 订单控制层
 * @Version: 1.0
 */

@RestController
@RequiredArgsConstructor
public class OrderController {
    private final OrderService orderService;
    //订单管理
    @PostMapping("getOrderInfo")
    public R getOrderInfo(@RequestBody OrderInfoReqDTO orderInfoReqDTO){
       return orderService.getOrderInfo(orderInfoReqDTO);
    }
    //订单管理详情页
    @PostMapping("getOrderdetail")
    public R getOrderdetail(@RequestParam Integer id){
        return orderService.getOrderdetail(id);
    }
    //销售统计（总店）
    @PostMapping("getSalesStatistics")
    public R getSalesStatistics(@RequestBody SalesStatisticsReqDTO salesStatisticsReqDTO){
        return orderService.getSalesStatistics(salesStatisticsReqDTO);
    }
    //销售统计（分店）
    @PostMapping("getBranchStatistics")
    public R getBranchStatistics(@RequestBody SalesStatisticsReqDTO salesStatisticsReqDTO){
        return orderService.getBranchStatistics(salesStatisticsReqDTO);
    }
    @PostMapping("getSalesDetail")
    public R getSalesDetail(@RequestBody SalesDetailReqDTO salesDetailReqDTO){
        return orderService.getSalesDetail(salesDetailReqDTO);
    }
}
